Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent dynamic dispatch from being used #66

Merged
merged 1 commit into from
Jun 9, 2017

Conversation

frederoni
Copy link
Contributor

Fixes #65
Swift or Obj-C applications extending UIColor or NSColor like:

extension UIColor {
    func toHexString() -> String {
        return "#000000"
    }
}

would override the internal toHexString() which excludes the # and would cause a corrupt URL.
This method gets overridden because the class inherits from NSObject and therefore makes use of dynamic dispatching.

Note that Swift 4.0 in unaffected by this bug/feature.

@1ec5 👀

@frederoni frederoni requested a review from 1ec5 June 8, 2017 22:07
@friedbunny
Copy link
Contributor

Thanks to @jrose-apple for making quick work of this question at the Swift lab this morning. 🙇

@frederoni frederoni merged commit 880c10d into master Jun 9, 2017
@frederoni frederoni deleted the fred-prevent-dynamic-dispatch branch June 9, 2017 05:28
@1ec5
Copy link
Contributor

1ec5 commented Jun 9, 2017

Thanks @jrose-apple! 👋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants